Check if the N-th element existsΒΆ

Check if the N-th element exists in a given list.
L = [1, 2, 3, 4, 5, 6]
last_idx = len(L) - 1

print(L[last_idx])    # 6